package GUI;
import processing.core.*;

public class Component
{
    public int x;
    public int y;
    public int width;
    public int height;
    public int style;
    public int backColor;
    public int alpha;
  
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    public Component()
    {
    	backColor = GV.processing.color(180, 180, 255,40);
    }
  
    public void draw()
    {
    		GV.processing.rectMode(GV.processing.CORNER);
        	GV.processing.noStroke();
        	GV.processing.fill(backColor);
            GV.processing.rect(x, y, width, height);
            
            GV.processing.strokeWeight(1);
            GV.processing.stroke(GV.processing.color(255, 255, 255), 255);
            GV.processing.line(x, y - 0, x + width, y - 0);
            GV.processing.line(x, y + height + 0, x + width, y + height + 0);
            GV.processing.line(x - 0, y, x - 0, y + height);
            GV.processing.line(x + width + 0, y, x + width + 0, y + height);
            
            
            GV.processing.strokeWeight(1);
            GV.processing.stroke(GV.processing.color(0, 0, 0), 180);
            GV.processing.line(x, y - 1, x + width, y - 1);
            GV.processing.line(x, y + height + 1, x + width, y + height + 1);
            GV.processing.line(x - 1, y, x - 1, y + height);
            GV.processing.line(x + width + 1, y, x + width + 1, y + height);
            
         


    }
  
  public boolean mouseOver()
  {
    if(GV.processing.mouseX > x && GV.processing.mouseX < x + width && 
    		GV.processing.mouseY > y && GV.processing.mouseY < y + height) 	return true;
      return false;
  }
  
  
  void bezierRect(float x, float y, float w, float h, float xr, float yr) {
	  float w2=w/2f, h2=h/2f, cx=x+w2, cy=y+h2;
	  GV.processing.beginShape();
	  GV.processing.vertex(cx,cy-h2);
	  GV.processing.bezierVertex(cx+w2-xr, cy-h2, cx+w2, cy-h2+yr, cx+w2, cy);
	  GV.processing.bezierVertex(cx+w2, cy+h2-yr, cx+w2-xr, cy+h2, cx, cy+h2);
	  GV.processing.bezierVertex(cx-w2+xr, cy+h2, cx-w2, cy+h2-yr, cx-w2, cy);
	  GV.processing.bezierVertex(cx-w2, cy-h2+yr, cx-w2+xr, cy-h2, cx, cy-h2);
	  GV.processing.endShape();
	 }
  
}
